package Kuang;

/**
 * description:
 * author:zcx
 * lenovo
 * 时间：2022.02.09.19.30
 */
public class Demo12 {
    public static void main(String[] args) {
        Boolean f=true;
        God g=new God();
        Yous y=new Yous();
        Thread t=new Thread(g);
        t.setDaemon(true);
        t.setPriority(5);
        t.start();

        new Thread(y).start();

    }
}
class God implements Runnable{
    @Override
    public void run() {
        while (true){
            try {
                Thread.sleep(1);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            System.out.println("上帝保佑你");
        }
    }
}

class Yous implements Runnable{
    @Override
    public void run() {

        for (int i = 0; i < 100; i++) {

            if(i==1){
                System.out.println("你出生了");
            }
            try {
                Thread.sleep(1);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            if(i==99){
                System.out.println("你去世了");
            }
        }
    }
}
